﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DQYT.HTDZ.Web;
using System.Data;
using Maticsoft.DBUtility;
namespace SkWeb.GeneralTools
{
    public partial class EditPwd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_OK_Click(object sender, EventArgs e)
        {
            string prePwd = this.prePwd.Text.Trim();
            string newPwd = this.newPwd.Text.Trim();
            string newPwd1 = this.newPwd1.Text.Trim();
            string user_id = DQYT.HTDZ.Web.Globals.CurrentUserInfo.USE_ID.ToString();

            string strSql = "select * from  tb_sys_user  where use_id=" + user_id + " and use_password='" + prePwd + "'";// +" and tmp_id= " + strTemplate_id;
            DataTable dt = OracleHelper.Query(strSql).Tables[0];

            if (newPwd != newPwd1)
            {
                Response.Write("<script>javascript:alert('密码前后不一致!');</script>");
                Response.End();
                return;
            }


            if (dt.Rows.Count > 0)
            {
                strSql = "update  tb_sys_user set  use_password ='" +newPwd +"'  where use_id=" + user_id ;
                OracleHelper.ExecuteSql(strSql);
                Response.Write("<script>javascript:alert('密码修改成功!');parent.closeChPwd();</script>");
            }
            else
            {
                Response.Write("<script>javascript:alert('原密码不正确!')</script>");
            }

        }
    }
}